/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ControllerLag;
import ModelLag.*;
import DBLag.*;
import java.util.ArrayList;

/**
 * Controllerklasse for Lane.
 * @author DM75 Gruppe 3
 * @version 2011-12-22
 */
public class MenuCTR 
{
    private IFDbMenu DbMenu;
    
    public MenuCTR()
    {
        DbMenu = new DbMenu();
    }
    
    /**
     * Finder Menu via menuName
     * @param menuName
     * @return
     */
    public Menu findMenu(String menuName)
    {
        return DbMenu.findMenu(menuName, false);
    }
    
    /**
     * Opretter en Menu via menuName og description
     * @param menuName
     * @param description
     * @return
     */
    public int createMenu(String menuName, String description)
    {
        Menu menuObj = new Menu(menuName,description);
        return DbMenu.insertMenu(menuObj, false);
    }
    
    
    /**
     * Opdatering af en Menu
     * @param menuName
     * @param description
     * @return
     */
    public int updateMenu(String menuName, String description)
    {
        Menu menuObj = new Menu();
        menuObj.setMenuName(menuName);
        menuObj.setDescription(description);
        
        return DbMenu.updateMenu(menuObj);
    }
    
    /**
     * Sletning af en Menu
     * @param menuName
     * @return
     */
    public int deleteMenu(String menuName)
    {
        return DbMenu.deleteMenu(menuName);
    }
    
    /**
     * Henter alle Menu som findes
     * @return
     */
    public ArrayList<Menu> getAllMenus()
    {
        return DbMenu.getAllMenus();
    }
}
